const express = require("express");

const router = express.Router();
const { maintModel } = require("../models/model");
// 获取所有用户列表
router.get("/maints", async (req, res) => {
  try {
    const maints = await maintModel.find();
    res.send({
      code: 200,
      data: maints,
    });
  } catch (err) {
    console.log(err);
    res.status(500).json({ message: "获取报修信息失败", err });
  }
});
router.post("/maints", async (req, res) => {
  let { _id } = req.body;
  await maintModel.findByIdAndUpdate(_id, { status: true });
  res.send({ message: "报修已处理",code:200 });
});
module.exports = router;
